﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _default : Base
{
    public int type = 1;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.RawUrl.IndexOf("new") > -1)
            type = 1;
        else if (Request.RawUrl.IndexOf("love") > -1)
            type = 2;
        else type = 1;
        base.PageSize = 10;
        BindImage();
        BindColor();
        BindClass();

    }

    public void BindImage()
    {
        BLL.Img bll = new BLL.Img();
        string sql = " IsPass =1  ";
        string sort = " AddTime desc";
        if (type == 2) sort = " LoveNum desc";

        Model.PageData<Model.Img> data = bll.GetList(10, base.PageIndex, sql, sort);

        Repeater1.DataSource = data.DataSoure;
        Repeater1.DataBind();
        pgServer.RecordCount = data.Count;
        //pgServer.EnableUrlRewriting = true;
        //string url = string.Format("list-{0}-{1}-{2}.html", base.TypeID, base.ColorID, base.Language);
        //pgServer.UrlRewritePattern = url + "?page={0}";
        pgServer.DataBind();
    }
    public void BindColor()
    {
        BLL.Color bll = new BLL.Color();
        List<Model.Color> colors = bll.GetList(" IsShow =1 order by addtime desc ");
        this.rptColor.DataSource = colors;
        this.rptColor.DataBind();
    }
    public void BindClass()
    {
        BLL.Classification bll = new BLL.Classification();
        List<Model.Classification> colors = bll.GetList(" IsShow =1 order by Ordinal asc ");
        this.rptClass.DataSource = colors;
        this.rptClass.DataBind();
    }
}